import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'

import Path from './config' //引入所有路径

Vue.use(VueRouter)

Vue.prototype.$path=Path //路径挂载到全局

const routes = [{
    path: Path.Home,  //默认去首页的路由
    name: 'Home',
    component: Home,
    children: [{
        path: Path.HomeIndex,  //默认显示首页的子路由
        component: () => import('../views/home/index.vue')
      },
      {
        path:Path.HomeList,   //分类子路由
        component:()=>import ('../views/list/list.vue')
      },
      {
        path: Path.HomeAdmin, //个人中心的子路由
        component: () => import('../views/admin/admin.vue')
      },
      {
        path:Path.HomeShopCar,
        component:()=>import ('../views/shopcar/shopcar.vue')
      }
    ]
  },
  {
    path: Path.KPriceShopList, //砍价的商品页
    meta:{title:'砍价列表',parentPath:'/'},
    component: () => import('../views/home/kPriceShop/kPriceShop.vue')
  },
  {
    path:Path.GoodNews,
    meta:{title:'精选文章',parentPath:"/"},  //精选文章页
    component:()=>import ('../views/home/strickNews/goodNews.vue')
  },
  {
    path:Path.Recommend,  //人气推荐页
    meta:{title:'人气推荐',parentPath:"/"},
    component:()=>import ('@/views/home/Recommend/recommend.vue')
  },
  {
    path:'/newsDetail',  //文章详情
    meta:{title:'文章详情',parentPath:'/goodNews'},
    component:()=>import ('../views/home/strickNews/newsDetail.vue')
  },
  {
    path:Path.Login,    //登录页面
    meta:{title:'用户登录'},
    component:()=>import ('../views/login.vue')
  },
  {
    path:Path.shopDetail,   //商品详情
    component:()=>import ('../views/home/kPriceShop/shopDetail.vue')
  },
  {
    path:Path.FriendHelp,   //朋友砍价页面
    component:()=>import ('../views/home/kPriceShop/friendHelp.vue')
  },
  {
    path:Path.goodShopDetail,   //好商品详情
    component:()=>import ('../views/home/Recommend/GoodShopDetail.vue')
  },
  {
    path:Path.Sign,   //签到页面
    component:()=> import ('../views/home/Sign/sign.vue')
  }


]

const router = new VueRouter({
  routes
})


export default router